﻿
@{
    ViewBag.Title = "LawDocumentPageList";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}

@section css{
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <style>
        .bg-light th {
            font-weight: bolder;
            text-align: center;
        }
    </style>
}
<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>文件管理</a>
            </li>
            <li class="crumb-trail">法律法规</li>
        </ol>
    </div>
</header>
<section id="content" class="animated fadeIn" ng-cloak ng-controller="LawController" ng-init="SearchModel={};page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     PageName='@Request.CurrentExecutionFilePath.Substring(Request.CurrentExecutionFilePath.LastIndexOf("/") + 1)';
     SearchModel={};
          GetLawCategoryList();
              GetOrgLevel();
         GetLawFormPageList(SearchModel,1);
          BindOrgList('select_org');
">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg">正在加载</div>
        </div>
    </div>
    <form class="form-horizontal">
        <div class="panel">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-filter"></span>搜索过滤
                </span>
            </div>
            <div class="panel-body fill">
                <div class="row">
                    <div class="form-group">
                        <label class="col-sm-1 control-label">文件编号</label>
                        <div class="col-lg-2">
                            <input type="text" class="form-control" ng-model="SearchModel.DocumentNo" placeholder="文件编号模糊查询" />
                        </div>

                        <label class="col-sm-1 control-label">文件名称</label>
                        <div class="col-lg-2">
                            <input type="text" class="form-control" ng-model="SearchModel.DocumentName" placeholder="文件名称模糊查询" />
                        </div>
                        <label class="col-sm-1 control-label">类别</label>
                        <div class="col-lg-2">
                            <select class="form-control" ng-model="SearchModel.CategoryId" placeholder="">
                                <option value="" selected>所有类别</option>
                                <option ng-repeat="x in CategoryList" value="{{x.Id}}">{{x.CategoryName}}</option>
                            </select>
                        </div>
                        <label class="col-sm-1 control-label">发布机构</label>
                        <div class="col-lg-2">
                            <select id="select_org" class="selectpicker show-tick form-control" multiple data-live-search="true">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label">状态</label>
                        <div class="col-lg-2">
                            <select class="form-control" ng-model="SearchModel.Status">
                                <option value="" selected>所有状态</option>
                                <option value="0">保存</option>
                                <option value="1">发布</option>
                                <option value="2">作废</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <button type="button" class="btn btn-primary" ng-click="GetLawFormPageList(SearchModel,1);">查询</button>
                        </div>
                    </div>

                </div>

            </div>
        </div>
        <div class="panel panel-info">
            <div class="panel-heading">
                <span class="panel-title">
                    <span class="glyphicons glyphicons-list"></span>法律法规列表 总数：{{result.totalItemCount}}
                </span>
                <div class="widget-menu pull-right mr10">
                    <div class="btn-group">
                        <a href="LawDocumentAdd?page={{result.currentPage}}" class="btn btn-xs btn-primary  light ">
                            <i class="fa fa-plus"></i>添加法律法规
                        </a>
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <table class="table table-bordered">
                    <thead>
                        <tr class="bg-light">
                            <th style="width:5%;">序号</th>
                            <th style="width:10%;">文件编号</th>
                            <th style="width:10%;">文件名称</th>
                            <th style="width:7%;">发布时间</th>
                            <th style="width:7%;">生效时间</th>
                            <th style="width:5%;">类别</th>
                            <th style="width:10%;">发布机构</th>
                            <th style="width:7%;">发布机构级别</th>

                            <th style="width:5%;">状态</th>
                            <th style="width:12%;">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-show="LawFormList.length==0 && !DataLoading">
                            <td colspan="12" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                        </tr>
                        <tr ng-repeat="x in LawFormList">
                            <td style="text-align:center;">
                                <span>{{((result.currentPage-1)*20)+($index+1)}}</span>
                            </td>
                            <td style="text-align:center;" ng-bind="x.DocumentNo"></td>
                            <td style="text-align:center;" ng-bind="x.DocumentName"></td>
                            <td style="text-align:center;">{{x.PublishTime|JSONDate:'yyyy-MM-dd'}}</td>
                            <td style="text-align:center;">{{x.ValidTime|JSONDate:'yyyy-MM-dd'}}</td>
                            <td style="text-align:center;" ng-bind="x.CategoryName"></td>
                            <td style="text-align:center;">{{x.PushlishOrgName}}</td>
                            <td style="text-align:center;" ng-bind="x.OrgLevelName"></td>
                            <td style="text-align:center;"><span ng-show="x.Status==0" class="label label-default">保存</span><span ng-show="x.Status==1" class="label label-primary">生效</span><span ng-show="x.Status==2" class="label label-default">作废</span></td>
                            <td>
                                <a data-toggle="modal" href="#InfoModal" ng-click="GetLawFormModel(x.Id);" class="btn btn-default btn-xs btn-label"><i class="fa fa-info-circle"></i> 详细</a>
                                <a ng-show="x.Status==0 ||x.Status==2 " href="LawDocumentEdit?Id={{x.Id}}" class="btn btn-primary btn-xs btn-label"><i class="fa fa-pencil-square-o"></i> 编辑</a>
                                <button ng-show="x.Status==0" ng-click="UpdateLawStatus(x,1,result.currentPage,SearchModel);" class="btn btn-system btn-xs btn-label"><i class="fa fa-send"></i> 发布</button>
                                <button ng-show="x.Status==1" ng-click="UpdateLawStatus(x,0,result.currentPage,SearchModel);" class="btn btn-warning btn-xs btn-label"><i class="fa fa-step-backward"></i> 撤回</button>
                                <button ng-click="DeleteLawForm(x,result.currentPage,SearchModel);" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash"></i> 删除</button>
                                <button ng-show="x.Status==1" ng-click="UpdateLawStatus(x,2,result.currentPage,SearchModel);" class="btn btn-dark btn-xs btn-label"><i class="fa fa-ban"></i> 废止</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>

        </div>
        <div class="text-center" ng-show="LawFormList!=null && LawFormList.length>0">
            <ul class="pagination  justify-content-center">
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetLawFormPageList(SearchModel,1);">首页</a></li>
                <li class="page-item" ng-class="{'active':result.currentPage==page}" ng-repeat="page in result.pages"><a style="cursor:pointer;" ng-click="GetLawFormPageList(SearchModel,page)" class="page-link" ng-bind="page"></a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetLawFormPageList(SearchModel,(result.currentPage + 1 > result.totalPage ? result.totalPage : result.currentPage + 1))">下一页</a></li>
                <li class="page-item"><a class="page-link" style="cursor:pointer;" ng-click="GetLawFormPageList(SearchModel,result.totalPage);">尾页</a></li>
            </ul>
        </div>


    </form>
    <div class="modal fade" id="InfoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="min-width:985px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h2 class="modal-title">{{LawForm.DocumentName}}</h2>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form">
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">文件编号</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" placeholder="必填项" ng-model="LawForm.DocumentNo" readonly/>
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-2 control-label">文件名称</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" placeholder="必填项" ng-model="LawForm.DocumentName" readonly/>
                            </div>
                            <div class="col-lg-1">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">生效时间</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" placeholder="必填项" format="L" ng-model="LawForm.ValidTime"></datepicker>
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-2 control-label">类别</label>
                            <div class="col-lg-3">
                                <select class="form-control" ng-model="LawForm.CategoryId" placeholder="" disabled>
                                    <option value="" selected>请选择类别</option>
                                    <option ng-repeat="x in CategoryList" value="{{x.Id}}">{{x.CategoryName}}</option>
                                </select>
                            </div>
                            <div class="col-lg-1">

                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">发布机构</label>
                            <div class="col-lg-3">
                               <input type="text" class="form-control" ng-model="LawForm.PushlishOrgName" readonly/>
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-2 control-label">发布机构级别</label>
                            <div class="col-lg-3">
                                <select class="form-control" ng-model="LawForm.OrgLevelId">
                                    <option value="" selected>请选择发布机构级别</option>
                                    <option ng-repeat="x in OrgLevelList" value="{{x.Id}}">{{x.OrgLevelName}}</option>
                                </select>
                            </div>
                            <div class="col-lg-1">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label"><b class="required">*</b>发布时间</label>
                            <div class="col-lg-3">
                                <datepicker id="startTime" option="datetimeOption" format="L" ng-model="LawForm.PublishTime"></datepicker>
                            </div>
                            <div class="col-lg-1">

                            </div>
                            <label for="inputStandard" class="col-lg-2 control-label">替代文件</label>
                            <div class="col-lg-3">
                                <input type="text" class="form-control" ng-model="LawForm.ReplaceDocument" />
                            </div>
                            <div class="col-lg-1">

                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">关键字</label>
                            <div class="col-lg-9">
                                <input type="text" class="form-control" ng-model="LawForm.Keywords" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">材料说明</label>
                            <div class="col-lg-9">
                                <textarea class="form-control" rows="5" ng-model="LawForm.Description">

                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">备注</label>
                            <div class="col-lg-9">
                                <textarea class="form-control" rows="5" ng-model="LawForm.Remark">

                                </textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">文件：</label>
                            <div class="col-sm-9">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件名称</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="LawForm.FileList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in LawForm.FileList">
                                            <td ng-bind="$index+1"></td>
                                            <td ng-bind="x.FileName"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="btn_close2">关闭</button>
                </div>
            </div>
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</section>

@section Js{
    <script src="~/bussiness/js/pg/Law.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/bussiness/js/libs/moment.min.js"></script>
    <script src="~/bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/bussiness/js/libs/fileinput.js"></script>
    <script src="~/bussiness/js/libs/zh.js"></script>
    <script>
        $(".selectpicker").selectpicker({
            noneSelectedText: "所有发布机构"
        });
    </script>
}


